package com.foreknow.demo6;

/**
 * Java中的三大特性(继承、封装、多态)
 * 1.封装：隐藏实现的细节  如何封装可以将所有的属性都定义为private(私有)
 * 2.private(私有)：表示只有当有类可以访问，其它类是不能访问这些私有的属性
 */
public class Employee {
    //编号
    private int card;
    //姓名
    private String name;
    //部门
    private String dept;
    //工资
    private double salary;

    //获取到属性的值
    public int getCard() {
        return card;
    }

    //作用可以给属性设置一个值  this:当前对象(Employee)自身
    public void setCard(int card) {
        this.card = card;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getDept() {
        return dept;
    }

    public void setDept(String dept) {
        this.dept = dept;
    }

    public double getSalary() {
        return salary;
    }

    public void setSalary(double salary) {
        this.salary = salary;
    }

    public static void main(String[] args) {
        Employee employee = new Employee();
        employee.name = "tom";
        employee.card = 1001;
        employee.dept = "market";
        System.out.println(employee.name+"--"+employee.card+"--"+employee.dept);
    }

}
